// 购物车
$("#topbar-cart").on("mouseenter",function(){
    $("#cart-menu").show();
    $("#header-search").hide();
}).on("mouseleave",function(){
    $("#cart-menu").hide();
    $("#header-search").show();    
});

//搜索框
$("#search-input").on("focus",function(){
    $("#search-input").css("border-color","rgb(255,103,0)");
    $("#btn").css("border-color","rgb(255,103,0)");
    $("#search-menus").show();
    $(".search-model").fadeOut();
}).on("blur",function(){
    $("#search-input").css("border-color","#e0e0e0");
    $("#btn").css("border-color","#e0e0e0");
    $("#search-menus").hide();
    $(".search-model").fadeIn();
});

// 下拉菜单
{
    var navItems = document.querySelectorAll(".nav-item");
    var headerMenus = document.querySelectorAll(".header-menus");
    for(var i = 0; i < navItems.length; i ++){
        navItems[i].index = i;
        navItems[i].onmouseenter = function(){
            headerMenus[this.index].style.display = "block";
        }
        navItems[i].onmouseleave = function(){
            headerMenus[this.index].style.display = "none";
        }
    }
    for(var i = 0; i < headerMenus.length; i ++){
        headerMenus[i].onmouseenter = function(){
            this.style.display = "block";
        }
        headerMenus[i].onmouseleave = function(){
            this.style.display = "none";
        }
    }
}

// 侧面菜单
{
    var showItems = document.querySelectorAll(".show-item");
    var sideMenus = document.querySelectorAll(".side-menus");
    for(var i = 0;i<showItems.length;i++){
        showItems[i].index = i;
        showItems[i].onmouseenter = function(){
            sideMenus[this.index].style.visibility = "visible";
        }
        showItems[i].onmouseleave = function(){
            sideMenus[this.index].style.visibility = "hidden";
        }
    }
    for(var i = 0;i<sideMenus.length;i++){
        sideMenus[i].onmouseenter = function(){
            this.style.visibility = "visible";
        }
        sideMenus[i].onmouseleave = function(){
            this.style.visibility = "hidden";
        }
    }
}

// 轮播图
{
    var pics = ["xmad_15169761220549_oNiXf.jpg","xmad_15172318170126_ysQaw.jpg","xmad_1517313508995_XRANt.jpg","xmad_15169762822641_YeJHE.jpg","xmad_15174153875989_pFKAB.jpg"]
    pics.forEach(function(el){
        $("<div></div>")
        .addClass("lbt-item")
        .css("background-image","url(img/"+el+")")
        .hide()
        .appendTo($("#show"));
    });
    // 箭头
    $("#right").on("click",function(){
        next();
        clearInterval(timer);
        timer = setInterval(next,5000);
    })
    $("#left").on("click",function(){
        previous();
        clearInterval(timer);
        timer = setInterval(next,5000);
    })
    // 白点
    for(var i = 0;i<pics.length;i++){
        $("<li></li>")
        .appendTo($("#points"))
        .css("cursor","pointer")
        .attr("index",i)
        .on("click",function(){
            var index = $(this).attr("index")*1;
            gotoPage(index);
        })
    }

    $("#points li").eq(0).addClass("high-lighted");
    // 记录当前第几张
    var currentPage = 0;
    // 前一张
    function previous(){
        $("#points li").eq(currentPage).removeClass("high-lighted");
        $(".lbt-item").eq(currentPage).fadeOut();    
        currentPage--;
        if(currentPage>=pics.length){
            currentPage = 0;
        }
        $(".lbt-item").eq(currentPage).fadeIn();
        $("#points li").eq(currentPage).addClass("high-lighted");
    }
    // 下一张
    function next(){
        $("#points li").eq(currentPage).removeClass("high-lighted");
        $(".lbt-item").eq(currentPage).fadeOut();    
        currentPage++;
        if(currentPage>=pics.length){
            currentPage = 0;
        }
        $(".lbt-item").eq(currentPage).fadeIn();
        $("#points li").eq(currentPage).addClass("high-lighted");
    }



    // 切换到第几页
    function gotoPage(page){
        $("#points li").eq(currentPage).removeClass("high-lighted");
        console.log(currentPage);
        $(".lbt-item").eq(currentPage).fadeOut();    
        currentPage = page;
        $("#points li").eq(currentPage).addClass("high-lighted");
        $(".lbt-item").eq(currentPage).fadeIn();
    }

    var timer = setInterval(next,5000);
}

// 单品轮播
{
    // 边框色
    var colors = ["#FFAC13","#83C44E","#2196F3","#E53935","#00C0A5"]
    for(var i = 0;i<$(".adc").length;i++){
        $(".adc").eq(i).css("border-top","1px solid"+colors[i % 5]);
    }
    // 切换
    var timer;
    function gotoPrev(){
        $(".goods-list").css("margin-left","0px");
        $(".control-prev").css("cursor","inherit");
        $(".control-next").css("cursor","pointer");
        timer = setTimeout(gotoNext,7000);
    }
    function gotoNext(){
        $(".goods-list").css("margin-left","-1240px");
        $(".control-next").css("cursor","inherit");
        $(".control-prev").css("cursor","pointer");
        timer = setTimeout(gotoPrev,7000);
    }
    gotoPrev();
    
    $(".control-prev").on("click",function(){
        gotoPrev();
        clearTimeout(timer);
        timer = setTimeout(gotoNext,7000);
    })
    $(".control-next").on("click",function(){
        gotoNext();
        clearTimeout(timer);
        timer = setTimeout(gotoPrev,7000);
    })
}

// ------------------家电模块----------------------------------
{
    var jiaDian =[[
        {name:"小米电视4A 32英寸",pic:"img/jiadian/remen01.jpg",desc:"64位四核处理器/1GB+4GB大内存",price:"999元"},
        {name:"小米电视4A 49英寸 标准版",pic:"img/jiadian/remen02.png",desc:"2GB+8GB大储存/全高清HDR",price:"2199元"},
        {name:'13.3"小米笔记本Air i5 8G 256G',pic:"img/jiadian/remen03.jpg",desc:"",price:"5199元"},
        {name:'15.6"小米笔记本Pro i7 16G ',pic:"img/jiadian/remen04.jpg",desc:"",price:"6999元"},
        {name:"飞利浦智睿蜡烛灯泡 水晶版",pic:"img/jiadian/remen05.jpg",desc:"亮度色温可调,十年使用寿命",price:"59元"},
        {name:"米家电水壶",pic:"img/jiadian/remen06.jpg",desc:"一杯水，是一家人的安心",price:"99元"},
        {name:"米家空气净化器Pro",pic:"img/jiadian/remen07.png",desc:"限量赠59元插线板",price:"1499元"},
        {name:"小白摄像机",pic:"img/jiadian/remen08.jpg",desc:"",price:"399元"},
        {desc:"热门"}
    ],[
        {name:"小米电视4A 55英寸",pic:"img/jiadian/dsyy01.png",desc:"4K高清HDR/真四核64位高性能处理器",price:"2899元"},
        {name:"小米电视4 55英寸 ",pic:"img/jiadian/dsyy02.jpg",desc:"4.9mm极超薄机身/2GB+8GB大内存",price:"4499元"},
        {name:"小米电视4A 32英寸",pic:"img/jiadian/dsyy03.jpg",desc:"64位四核处理器/1GB+4GB大内存",price:"999元"},
        {name:"小米电视4A 65英寸",pic:"img/jiadian/dsyy04.png",desc:"4K超高清/真四核64位高性能处理器",price:"4999元"},
        {name:"小米电视4A 43英寸",pic:"img/jiadian/dsyy05.png",desc:"全高清屏/人工智能语音/大存储",price:"1999元"},
        {name:"小米电视4C 43英寸",pic:"img/jiadian/dsyy06.png",desc:"人工智能/全高清屏幕/大内存",price:"1799元"},
        {name:"小米盒子3 增强版",pic:"img/jiadian/dsyy07.jpg",desc:"高端4K网络机顶盒",price:"399元"},
        {name:"小米盒子3s",pic:"img/jiadian/dsyy08.jpg",desc:"",price:"299元"},
        {desc:"电视影音"}
    ],[
        {name:'12.5"小米笔记本Air M3 4G 128G',pic:"img/jiadian/diannao01.jpg",desc:"",price:"3599元"},
        {name:"小米笔记本Air13.3英寸",pic:"img/jiadian/diannao02.jpg",desc:"第7代CPU 2G独显 指纹解锁",price:"5199元"},
        {name:"小米笔记本Air 13.3英寸",pic:"img/jiadian/diannao03.jpg",desc:"Intel酷睿i5处理器 独立显卡",price:"4999元"},
        {name:"小米笔记本Air 12.5英寸",pic:"img/jiadian/diannao04.jpg",desc:"更轻更薄，像杂志一样随身携带",price:"3999元"},
        {name:"小米无线鼠标",pic:"img/jiadian/diannao05.png",desc:"耐脏亲肤涂层，人体工学设计",price:"69元"},
        {name:"小米便携鼠标",pic:"img/jiadian/diannao06.jpg",desc:"轻薄便携，铝合金外壳+ABS材质",price:"99元"},
        {name:"悦米机械键盘",pic:"img/jiadian/diannao07.png",desc:"铝合金机身，TTC红轴，87键",price:"289元"},
        {name:"多功能转接器",pic:"img/jiadian/diannao08.jpg",price:"379元"},
        {desc:"电脑"}
    ],[
        {name:"米家恒温电水壶",pic:"img/jiadian/jiaju01.jpg",desc:"水温智能控制，304不锈钢内胆",price:"199元"},
        {name:"小米随身手电筒",pic:"img/jiadian/jiaju02.jpg",desc:"11档调光，随心而亮",price:"79元"},
        {name:"米家扫地机器人",pic:"img/jiadian/jiaju03.jpg",desc:"智能路径规划，扫得干净扫得快",price:"1699元"},
        {name:"小米空气净化器2",pic:"img/jiadian/jiaju04.jpg",desc:"10分钟，房间空气焕然一新",price:"699元"},
        {name:"米家压力IH电饭煲",pic:"img/jiadian/jiaju05.jpg",desc:"智能烹饪，灰铸铁粉体涂层内胆",price:"999元"},
        {name:"飞利浦智睿球泡灯",pic:"img/jiadian/jiaju06.jpg",desc:"自由调节亮度，Wi-Fi随时操控",price:"49元"},
        {name:"米家LED智能台灯",pic:"img/jiadian/jiaju07.jpg",desc:"无可视频闪，四种场景优化调光",price:"169元"},
        {name:"Yeelight LED 吸顶灯",pic:"img/jiadian/jiaju08.png",price:"379元"},
        {desc:"家居"}
    ]]
    for(var i = 0; i < jiaDian.length; i ++){
        $("<ul></ul>").addClass("brick-list clear-fix:after").appendTo($("#jiadian .modle-bottom-right"));
        for(var j = 0; j < jiaDian[i].length - 2; j ++){
            $("<li></li>").addClass("brick-item brick-item-m").appendTo($("#jiadian ul.brick-list").eq(i));
            $("<img src="+ jiaDian[i][j].pic +">").appendTo($("#jiadian ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + jiaDian[i][j].name + "</p>").appendTo($("#jiadian ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + jiaDian[i][j].desc + "</p>").addClass("desc").appendTo($("#jiadian ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + jiaDian[i][j].price + "</p>").addClass("price").appendTo($("#jiadian ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
        }
        $("<li></li>").addClass("brick-item brick-item-s").appendTo($("#jiadian ul.brick-list").eq(i));
        $("<img src="+ jiaDian[i][7].pic +">").appendTo($("#jiadian ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<p>" + jiaDian[i][7].name + "</p>").appendTo($("#jiadian ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<p>" + jiaDian[i][7].price + "</p>").addClass("price").appendTo($("#jiadian ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<li></li>").addClass("brick-item brick-item-s").appendTo($("#jiadian ul.brick-list").eq(i));
        $("<small>" + jiaDian[i][8].desc + "</small>").appendTo($("<a>浏览更多</a>").appendTo($("#jiadian ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(8)));    
        $("<i></i>").addClass("fa fa-angle-right").appendTo($("#jiadian ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(8));
    }
    var currentJiadian = 0;
    $("#jiadian ul.brick-list").eq(currentJiadian).show();
    $("#jiadian ul.tab-list>li").eq(currentJiadian).addClass("tab-active");
    for(var i = 0; i < $("#jiadian .tab-list>li").length; i ++){
        $("#jiadian .tab-list>li")[i].index = i;
        $("#jiadian .tab-list>li").eq(i).on("mouseenter", function(){
            $("#jiadian ul.tab-list>li").eq(currentJiadian).removeClass("tab-active");
            $("#jiadian ul.brick-list").eq(currentJiadian).hide();
            currentJiadian = this.index;
            $("#jiadian .brick-list").eq(this.index).show();
            $("#jiadian ul.tab-list>li").eq(currentJiadian).addClass("tab-active");
        });
    };
}
// ------------------智能模块----------------------------------
{
    var smart =[[
        {name:"小米电视4A 32英寸",pic:"img/jiadian/remen01.jpg",desc:"64位四核处理器/1GB+4GB大内存",price:"999元"},
        {name:"小米电视4A 49英寸 标准版",pic:"img/jiadian/remen02.png",desc:"2GB+8GB大储存/全高清HDR",price:"2199元"},
        {name:'13.3"小米笔记本Air i5 8G 256G',pic:"img/jiadian/remen03.jpg",desc:"",price:"5199元"},
        {name:'15.6"小米笔记本Pro i7 16G ',pic:"img/jiadian/remen04.jpg",desc:"",price:"6999元"},
        {name:"飞利浦智睿蜡烛灯泡 水晶版",pic:"img/jiadian/remen05.jpg",desc:"亮度色温可调,十年使用寿命",price:"59元"},
        {name:"米家电水壶",pic:"img/jiadian/remen06.jpg",desc:"一杯水，是一家人的安心",price:"99元"},
        {name:"米家空气净化器Pro",pic:"img/jiadian/remen07.png",desc:"限量赠59元插线板",price:"1499元"},
        {name:"小白摄像机",pic:"img/jiadian/remen08.jpg",desc:"",price:"399元"},
        {desc:"热门"}
    ],[
        {name:"小米电视4A 55英寸",pic:"img/jiadian/dsyy01.png",desc:"4K高清HDR/真四核64位高性能处理器",price:"2899元"},
        {name:"小米电视4 55英寸 ",pic:"img/jiadian/dsyy02.jpg",desc:"4.9mm极超薄机身/2GB+8GB大内存",price:"4499元"},
        {name:"小米电视4A 32英寸",pic:"img/jiadian/dsyy03.jpg",desc:"64位四核处理器/1GB+4GB大内存",price:"999元"},
        {name:"小米电视4A 65英寸",pic:"img/jiadian/dsyy04.png",desc:"4K超高清/真四核64位高性能处理器",price:"4999元"},
        {name:"小米电视4A 43英寸",pic:"img/jiadian/dsyy05.png",desc:"全高清屏/人工智能语音/大存储",price:"1999元"},
        {name:"小米电视4C 43英寸",pic:"img/jiadian/dsyy06.png",desc:"人工智能/全高清屏幕/大内存",price:"1799元"},
        {name:"小米盒子3 增强版",pic:"img/jiadian/dsyy07.jpg",desc:"高端4K网络机顶盒",price:"399元"},
        {name:"小米盒子3s",pic:"img/jiadian/dsyy08.jpg",desc:"",price:"299元"},
        {desc:"电视影音"}
    ],[
        {name:'12.5"小米笔记本Air M3 4G 128G',pic:"img/jiadian/diannao01.jpg",desc:"",price:"3599元"},
        {name:"小米笔记本Air13.3英寸",pic:"img/jiadian/diannao02.jpg",desc:"第7代CPU 2G独显 指纹解锁",price:"5199元"},
        {name:"小米笔记本Air 13.3英寸",pic:"img/jiadian/diannao03.jpg",desc:"Intel酷睿i5处理器 独立显卡",price:"4999元"},
        {name:"小米笔记本Air 12.5英寸",pic:"img/jiadian/diannao04.jpg",desc:"更轻更薄，像杂志一样随身携带",price:"3999元"},
        {name:"小米无线鼠标",pic:"img/jiadian/diannao05.png",desc:"耐脏亲肤涂层，人体工学设计",price:"69元"},
        {name:"小米便携鼠标",pic:"img/jiadian/diannao06.jpg",desc:"轻薄便携，铝合金外壳+ABS材质",price:"99元"},
        {name:"悦米机械键盘",pic:"img/jiadian/diannao07.png",desc:"铝合金机身，TTC红轴，87键",price:"289元"},
        {name:"多功能转接器",pic:"img/jiadian/diannao08.jpg",price:"379元"},
        {desc:"电脑"}
    ],[
        {name:"米家恒温电水壶",pic:"img/jiadian/jiaju01.jpg",desc:"水温智能控制，304不锈钢内胆",price:"199元"},
        {name:"小米随身手电筒",pic:"img/jiadian/jiaju02.jpg",desc:"11档调光，随心而亮",price:"79元"},
        {name:"米家扫地机器人",pic:"img/jiadian/jiaju03.jpg",desc:"智能路径规划，扫得干净扫得快",price:"1699元"},
        {name:"小米空气净化器2",pic:"img/jiadian/jiaju04.jpg",desc:"10分钟，房间空气焕然一新",price:"699元"},
        {name:"米家压力IH电饭煲",pic:"img/jiadian/jiaju05.jpg",desc:"智能烹饪，灰铸铁粉体涂层内胆",price:"999元"},
        {name:"飞利浦智睿球泡灯",pic:"img/jiadian/jiaju06.jpg",desc:"自由调节亮度，Wi-Fi随时操控",price:"49元"},
        {name:"米家LED智能台灯",pic:"img/jiadian/jiaju07.jpg",desc:"无可视频闪，四种场景优化调光",price:"169元"},
        {name:"Yeelight LED 吸顶灯",pic:"img/jiadian/jiaju08.png",price:"379元"},
        {desc:"家居"}
    ],[
        {name:"米家恒温电水壶",pic:"img/jiadian/jiaju01.jpg",desc:"水温智能控制，304不锈钢内胆",price:"199元"},
        {name:"小米随身手电筒",pic:"img/jiadian/jiaju02.jpg",desc:"11档调光，随心而亮",price:"79元"},
        {name:"米家扫地机器人",pic:"img/jiadian/jiaju03.jpg",desc:"智能路径规划，扫得干净扫得快",price:"1699元"},
        {name:"小米空气净化器2",pic:"img/jiadian/jiaju04.jpg",desc:"10分钟，房间空气焕然一新",price:"699元"},
        {name:"米家压力IH电饭煲",pic:"img/jiadian/jiaju05.jpg",desc:"智能烹饪，灰铸铁粉体涂层内胆",price:"999元"},
        {name:"飞利浦智睿球泡灯",pic:"img/jiadian/jiaju06.jpg",desc:"自由调节亮度，Wi-Fi随时操控",price:"49元"},
        {name:"米家LED智能台灯",pic:"img/jiadian/jiaju07.jpg",desc:"无可视频闪，四种场景优化调光",price:"169元"},
        {name:"Yeelight LED 吸顶灯",pic:"img/jiadian/jiaju08.png",price:"379元"},
        {desc:"家居"}
    ]];
    for(var i = 0; i < smart.length; i ++){
        $("<ul></ul>").addClass("brick-list clear-fix:after").appendTo($("#smart .modle-bottom-right"));
        for(var j = 0; j < smart[i].length - 2; j ++){
            $("<li></li>").addClass("brick-item brick-item-m").appendTo($("#smart ul.brick-list").eq(i));
            $("<img src="+ smart[i][j].pic +">").appendTo($("#smart ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + smart[i][j].name + "</p>").appendTo($("#smart ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + smart[i][j].desc + "</p>").addClass("desc").appendTo($("#smart ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + smart[i][j].price + "</p>").addClass("price").appendTo($("#smart ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
        }
        $("<li></li>").addClass("brick-item brick-item-s").appendTo($("#smart ul.brick-list").eq(i));
        $("<img src="+ smart[i][7].pic +">").appendTo($("#smart ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<p>" + smart[i][7].name + "</p>").appendTo($("#smart ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<p>" + smart[i][7].price + "</p>").addClass("price").appendTo($("#smart ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<li></li>").addClass("brick-item brick-item-s").appendTo($("#smart ul.brick-list").eq(i));
        $("<small>" + smart[i][8].desc + "</small>").appendTo($("<a>浏览更多</a>").appendTo($("#smart ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(8)));    
        $("<i></i>").addClass("fa fa-angle-right").appendTo($("#smart ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(8));
    }
    var currentSmart = 0;
    $("#smart ul.brick-list").eq(currentSmart).show();
    $("#smart ul.tab-list>li").eq(currentSmart).addClass("tab-active");
    for(var i = 0; i < $("#smart .tab-list>li").length; i ++){
        $("#smart .tab-list>li")[i].index = i;
        $("#smart .tab-list>li").eq(i).on("mouseenter", function(){
            $("#smart ul.tab-list>li").eq(currentSmart).removeClass("tab-active");
            $("#smart ul.brick-list").eq(currentSmart).hide();
            currentSmart = this.index;
            $("#smart .brick-list").eq(this.index).show();
            $("#smart ul.tab-list>li").eq(currentSmart).addClass("tab-active");
        });
    };
}
// ------------------搭配模块----------------------------------
{
    var match =[[
        {name:"小米电视4A 32英寸",pic:"img/jiadian/remen01.jpg",desc:"64位四核处理器/1GB+4GB大内存",price:"999元"},
        {name:"小米电视4A 49英寸 标准版",pic:"img/jiadian/remen02.png",desc:"2GB+8GB大储存/全高清HDR",price:"2199元"},
        {name:'13.3"小米笔记本Air i5 8G 256G',pic:"img/jiadian/remen03.jpg",desc:"",price:"5199元"},
        {name:'15.6"小米笔记本Pro i7 16G ',pic:"img/jiadian/remen04.jpg",desc:"",price:"6999元"},
        {name:"飞利浦智睿蜡烛灯泡 水晶版",pic:"img/jiadian/remen05.jpg",desc:"亮度色温可调,十年使用寿命",price:"59元"},
        {name:"米家电水壶",pic:"img/jiadian/remen06.jpg",desc:"一杯水，是一家人的安心",price:"99元"},
        {name:"米家空气净化器Pro",pic:"img/jiadian/remen07.png",desc:"限量赠59元插线板",price:"1499元"},
        {name:"小白摄像机",pic:"img/jiadian/remen08.jpg",desc:"",price:"399元"},
        {desc:"热门"}
    ],[
        {name:"小米电视4A 55英寸",pic:"img/jiadian/dsyy01.png",desc:"4K高清HDR/真四核64位高性能处理器",price:"2899元"},
        {name:"小米电视4 55英寸 ",pic:"img/jiadian/dsyy02.jpg",desc:"4.9mm极超薄机身/2GB+8GB大内存",price:"4499元"},
        {name:"小米电视4A 32英寸",pic:"img/jiadian/dsyy03.jpg",desc:"64位四核处理器/1GB+4GB大内存",price:"999元"},
        {name:"小米电视4A 65英寸",pic:"img/jiadian/dsyy04.png",desc:"4K超高清/真四核64位高性能处理器",price:"4999元"},
        {name:"小米电视4A 43英寸",pic:"img/jiadian/dsyy05.png",desc:"全高清屏/人工智能语音/大存储",price:"1999元"},
        {name:"小米电视4C 43英寸",pic:"img/jiadian/dsyy06.png",desc:"人工智能/全高清屏幕/大内存",price:"1799元"},
        {name:"小米盒子3 增强版",pic:"img/jiadian/dsyy07.jpg",desc:"高端4K网络机顶盒",price:"399元"},
        {name:"小米盒子3s",pic:"img/jiadian/dsyy08.jpg",desc:"",price:"299元"},
        {desc:"电视影音"}
    ],[
        {name:'12.5"小米笔记本Air M3 4G 128G',pic:"img/jiadian/diannao01.jpg",desc:"",price:"3599元"},
        {name:"小米笔记本Air13.3英寸",pic:"img/jiadian/diannao02.jpg",desc:"第7代CPU 2G独显 指纹解锁",price:"5199元"},
        {name:"小米笔记本Air 13.3英寸",pic:"img/jiadian/diannao03.jpg",desc:"Intel酷睿i5处理器 独立显卡",price:"4999元"},
        {name:"小米笔记本Air 12.5英寸",pic:"img/jiadian/diannao04.jpg",desc:"更轻更薄，像杂志一样随身携带",price:"3999元"},
        {name:"小米无线鼠标",pic:"img/jiadian/diannao05.png",desc:"耐脏亲肤涂层，人体工学设计",price:"69元"},
        {name:"小米便携鼠标",pic:"img/jiadian/diannao06.jpg",desc:"轻薄便携，铝合金外壳+ABS材质",price:"99元"},
        {name:"悦米机械键盘",pic:"img/jiadian/diannao07.png",desc:"铝合金机身，TTC红轴，87键",price:"289元"},
        {name:"多功能转接器",pic:"img/jiadian/diannao08.jpg",price:"379元"},
        {desc:"电脑"}
    ],[
        {name:"米家恒温电水壶",pic:"img/jiadian/jiaju01.jpg",desc:"水温智能控制，304不锈钢内胆",price:"199元"},
        {name:"小米随身手电筒",pic:"img/jiadian/jiaju02.jpg",desc:"11档调光，随心而亮",price:"79元"},
        {name:"米家扫地机器人",pic:"img/jiadian/jiaju03.jpg",desc:"智能路径规划，扫得干净扫得快",price:"1699元"},
        {name:"小米空气净化器2",pic:"img/jiadian/jiaju04.jpg",desc:"10分钟，房间空气焕然一新",price:"699元"},
        {name:"米家压力IH电饭煲",pic:"img/jiadian/jiaju05.jpg",desc:"智能烹饪，灰铸铁粉体涂层内胆",price:"999元"},
        {name:"飞利浦智睿球泡灯",pic:"img/jiadian/jiaju06.jpg",desc:"自由调节亮度，Wi-Fi随时操控",price:"49元"},
        {name:"米家LED智能台灯",pic:"img/jiadian/jiaju07.jpg",desc:"无可视频闪，四种场景优化调光",price:"169元"},
        {name:"Yeelight LED 吸顶灯",pic:"img/jiadian/jiaju08.png",price:"379元"},
        {desc:"家居"}
    ]]
    for(var i = 0; i < match.length; i ++){
        $("<ul></ul>").addClass("brick-list clear-fix:after").appendTo($("#match .modle-bottom-right"));
        for(var j = 0; j < match[i].length - 2; j ++){
            $("<li></li>").addClass("brick-item brick-item-m").appendTo($("#match ul.brick-list").eq(i));
            $("<img src="+ match[i][j].pic +">").appendTo($("#match ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + match[i][j].name + "</p>").appendTo($("#match ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + match[i][j].desc + "</p>").addClass("desc").appendTo($("#match ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + match[i][j].price + "</p>").addClass("price").appendTo($("#match ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
        }
        $("<li></li>").addClass("brick-item brick-item-s").appendTo($("#match ul.brick-list").eq(i));
        $("<img src="+ match[i][7].pic +">").appendTo($("#match ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<p>" + match[i][7].name + "</p>").appendTo($("#match ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<p>" + match[i][7].price + "</p>").addClass("price").appendTo($("#match ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<li></li>").addClass("brick-item brick-item-s").appendTo($("#match ul.brick-list").eq(i));
        $("<small>" + match[i][8].desc + "</small>").appendTo($("<a>浏览更多</a>").appendTo($("#match ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(8)));    
        $("<i></i>").addClass("fa fa-angle-right").appendTo($("#match ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(8));
    }
    var currentMatch = 0;
    $("#match ul.brick-list").eq(currentMatch).show();
    $("#match ul.tab-list>li").eq(currentMatch).addClass("tab-active");
    for(var i = 0; i < $("#match .tab-list>li").length; i ++){
        $("#match .tab-list>li")[i].index = i;
        $("#match .tab-list>li").eq(i).on("mouseenter", function(){
            $("#match ul.tab-list>li").eq(currentMatch).removeClass("tab-active");
            $("#match ul.brick-list").eq(currentMatch).hide();
            currentMatch = this.index;
            $("#match .brick-list").eq(this.index).show();
            $("#match ul.tab-list>li").eq(currentMatch).addClass("tab-active");
        });
    };
}
// ------------------配件模块----------------------------------
{
    var accessories =[[
        {name:"小米电视4A 32英寸",pic:"img/jiadian/remen01.jpg",desc:"64位四核处理器/1GB+4GB大内存",price:"999元"},
        {name:"小米电视4A 49英寸 标准版",pic:"img/jiadian/remen02.png",desc:"2GB+8GB大储存/全高清HDR",price:"2199元"},
        {name:'13.3"小米笔记本Air i5 8G 256G',pic:"img/jiadian/remen03.jpg",desc:"",price:"5199元"},
        {name:'15.6"小米笔记本Pro i7 16G ',pic:"img/jiadian/remen04.jpg",desc:"",price:"6999元"},
        {name:"飞利浦智睿蜡烛灯泡 水晶版",pic:"img/jiadian/remen05.jpg",desc:"亮度色温可调,十年使用寿命",price:"59元"},
        {name:"米家电水壶",pic:"img/jiadian/remen06.jpg",desc:"一杯水，是一家人的安心",price:"99元"},
        {name:"米家空气净化器Pro",pic:"img/jiadian/remen07.png",desc:"限量赠59元插线板",price:"1499元"},
        {name:"小白摄像机",pic:"img/jiadian/remen08.jpg",desc:"",price:"399元"},
        {desc:"热门"}
    ],[
        {name:"小米电视4A 55英寸",pic:"img/jiadian/dsyy01.png",desc:"4K高清HDR/真四核64位高性能处理器",price:"2899元"},
        {name:"小米电视4 55英寸 ",pic:"img/jiadian/dsyy02.jpg",desc:"4.9mm极超薄机身/2GB+8GB大内存",price:"4499元"},
        {name:"小米电视4A 32英寸",pic:"img/jiadian/dsyy03.jpg",desc:"64位四核处理器/1GB+4GB大内存",price:"999元"},
        {name:"小米电视4A 65英寸",pic:"img/jiadian/dsyy04.png",desc:"4K超高清/真四核64位高性能处理器",price:"4999元"},
        {name:"小米电视4A 43英寸",pic:"img/jiadian/dsyy05.png",desc:"全高清屏/人工智能语音/大存储",price:"1999元"},
        {name:"小米电视4C 43英寸",pic:"img/jiadian/dsyy06.png",desc:"人工智能/全高清屏幕/大内存",price:"1799元"},
        {name:"小米盒子3 增强版",pic:"img/jiadian/dsyy07.jpg",desc:"高端4K网络机顶盒",price:"399元"},
        {name:"小米盒子3s",pic:"img/jiadian/dsyy08.jpg",desc:"",price:"299元"},
        {desc:"电视影音"}
    ],[
        {name:'12.5"小米笔记本Air M3 4G 128G',pic:"img/jiadian/diannao01.jpg",desc:"",price:"3599元"},
        {name:"小米笔记本Air13.3英寸",pic:"img/jiadian/diannao02.jpg",desc:"第7代CPU 2G独显 指纹解锁",price:"5199元"},
        {name:"小米笔记本Air 13.3英寸",pic:"img/jiadian/diannao03.jpg",desc:"Intel酷睿i5处理器 独立显卡",price:"4999元"},
        {name:"小米笔记本Air 12.5英寸",pic:"img/jiadian/diannao04.jpg",desc:"更轻更薄，像杂志一样随身携带",price:"3999元"},
        {name:"小米无线鼠标",pic:"img/jiadian/diannao05.png",desc:"耐脏亲肤涂层，人体工学设计",price:"69元"},
        {name:"小米便携鼠标",pic:"img/jiadian/diannao06.jpg",desc:"轻薄便携，铝合金外壳+ABS材质",price:"99元"},
        {name:"悦米机械键盘",pic:"img/jiadian/diannao07.png",desc:"铝合金机身，TTC红轴，87键",price:"289元"},
        {name:"多功能转接器",pic:"img/jiadian/diannao08.jpg",price:"379元"},
        {desc:"电脑"}
    ],[
        {name:"米家恒温电水壶",pic:"img/jiadian/jiaju01.jpg",desc:"水温智能控制，304不锈钢内胆",price:"199元"},
        {name:"小米随身手电筒",pic:"img/jiadian/jiaju02.jpg",desc:"11档调光，随心而亮",price:"79元"},
        {name:"米家扫地机器人",pic:"img/jiadian/jiaju03.jpg",desc:"智能路径规划，扫得干净扫得快",price:"1699元"},
        {name:"小米空气净化器2",pic:"img/jiadian/jiaju04.jpg",desc:"10分钟，房间空气焕然一新",price:"699元"},
        {name:"米家压力IH电饭煲",pic:"img/jiadian/jiaju05.jpg",desc:"智能烹饪，灰铸铁粉体涂层内胆",price:"999元"},
        {name:"飞利浦智睿球泡灯",pic:"img/jiadian/jiaju06.jpg",desc:"自由调节亮度，Wi-Fi随时操控",price:"49元"},
        {name:"米家LED智能台灯",pic:"img/jiadian/jiaju07.jpg",desc:"无可视频闪，四种场景优化调光",price:"169元"},
        {name:"Yeelight LED 吸顶灯",pic:"img/jiadian/jiaju08.png",price:"379元"},
        {desc:"家居"}
    ]]
    for(var i = 0; i < accessories.length; i ++){
        $("<ul></ul>").addClass("brick-list clear-fix:after").appendTo($("#accessories .modle-bottom-right"));
        for(var j = 0; j < accessories[i].length - 2; j ++){
            $("<li></li>").addClass("brick-item brick-item-m").appendTo($("#accessories ul.brick-list").eq(i));
            $("<img src="+ accessories[i][j].pic +">").appendTo($("#accessories ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + accessories[i][j].name + "</p>").appendTo($("#accessories ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + accessories[i][j].desc + "</p>").addClass("desc").appendTo($("#accessories ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + accessories[i][j].price + "</p>").addClass("price").appendTo($("#accessories ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
        }
        $("<li></li>").addClass("brick-item brick-item-s").appendTo($("#accessories ul.brick-list").eq(i));
        $("<img src="+ accessories[i][7].pic +">").appendTo($("#accessories ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<p>" + accessories[i][7].name + "</p>").appendTo($("#accessories ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<p>" + accessories[i][7].price + "</p>").addClass("price").appendTo($("#accessories ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<li></li>").addClass("brick-item brick-item-s").appendTo($("#accessories ul.brick-list").eq(i));
        $("<small>" + accessories[i][8].desc + "</small>").appendTo($("<a>浏览更多</a>").appendTo($("#accessories ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(8)));    
        $("<i></i>").addClass("fa fa-angle-right").appendTo($("#accessories ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(8));
    }
    var currentAccessories = 0;
    $("#accessories ul.brick-list").eq(currentAccessories).show();
    $("#accessories ul.tab-list>li").eq(currentAccessories).addClass("tab-active");
    for(var i = 0; i < $("#accessories .tab-list>li").length; i ++){
        $("#accessories .tab-list>li")[i].index = i;
        $("#accessories .tab-list>li").eq(i).on("mouseenter", function(){
            $("#accessories ul.tab-list>li").eq(currentAccessories).removeClass("tab-active");
            $("#accessories ul.brick-list").eq(currentAccessories).hide();
            currentAccessories = this.index;
            $("#accessories .brick-list").eq(this.index).show();
            $("#accessories ul.tab-list>li").eq(currentAccessories).addClass("tab-active");
        });
    };
}
// ------------------周边模块----------------------------------
{
    var around =[[
        {name:"小米电视4A 32英寸",pic:"img/jiadian/remen01.jpg",desc:"64位四核处理器/1GB+4GB大内存",price:"999元"},
        {name:"小米电视4A 49英寸 标准版",pic:"img/jiadian/remen02.png",desc:"2GB+8GB大储存/全高清HDR",price:"2199元"},
        {name:'13.3"小米笔记本Air i5 8G 256G',pic:"img/jiadian/remen03.jpg",desc:"",price:"5199元"},
        {name:'15.6"小米笔记本Pro i7 16G ',pic:"img/jiadian/remen04.jpg",desc:"",price:"6999元"},
        {name:"飞利浦智睿蜡烛灯泡 水晶版",pic:"img/jiadian/remen05.jpg",desc:"亮度色温可调,十年使用寿命",price:"59元"},
        {name:"米家电水壶",pic:"img/jiadian/remen06.jpg",desc:"一杯水，是一家人的安心",price:"99元"},
        {name:"米家空气净化器Pro",pic:"img/jiadian/remen07.png",desc:"限量赠59元插线板",price:"1499元"},
        {name:"小白摄像机",pic:"img/jiadian/remen08.jpg",desc:"",price:"399元"},
        {desc:"热门"}
    ],[
        {name:"小米电视4A 55英寸",pic:"img/jiadian/dsyy01.png",desc:"4K高清HDR/真四核64位高性能处理器",price:"2899元"},
        {name:"小米电视4 55英寸 ",pic:"img/jiadian/dsyy02.jpg",desc:"4.9mm极超薄机身/2GB+8GB大内存",price:"4499元"},
        {name:"小米电视4A 32英寸",pic:"img/jiadian/dsyy03.jpg",desc:"64位四核处理器/1GB+4GB大内存",price:"999元"},
        {name:"小米电视4A 65英寸",pic:"img/jiadian/dsyy04.png",desc:"4K超高清/真四核64位高性能处理器",price:"4999元"},
        {name:"小米电视4A 43英寸",pic:"img/jiadian/dsyy05.png",desc:"全高清屏/人工智能语音/大存储",price:"1999元"},
        {name:"小米电视4C 43英寸",pic:"img/jiadian/dsyy06.png",desc:"人工智能/全高清屏幕/大内存",price:"1799元"},
        {name:"小米盒子3 增强版",pic:"img/jiadian/dsyy07.jpg",desc:"高端4K网络机顶盒",price:"399元"},
        {name:"小米盒子3s",pic:"img/jiadian/dsyy08.jpg",desc:"",price:"299元"},
        {desc:"电视影音"}
    ],[
        {name:'12.5"小米笔记本Air M3 4G 128G',pic:"img/jiadian/diannao01.jpg",desc:"",price:"3599元"},
        {name:"小米笔记本Air13.3英寸",pic:"img/jiadian/diannao02.jpg",desc:"第7代CPU 2G独显 指纹解锁",price:"5199元"},
        {name:"小米笔记本Air 13.3英寸",pic:"img/jiadian/diannao03.jpg",desc:"Intel酷睿i5处理器 独立显卡",price:"4999元"},
        {name:"小米笔记本Air 12.5英寸",pic:"img/jiadian/diannao04.jpg",desc:"更轻更薄，像杂志一样随身携带",price:"3999元"},
        {name:"小米无线鼠标",pic:"img/jiadian/diannao05.png",desc:"耐脏亲肤涂层，人体工学设计",price:"69元"},
        {name:"小米便携鼠标",pic:"img/jiadian/diannao06.jpg",desc:"轻薄便携，铝合金外壳+ABS材质",price:"99元"},
        {name:"悦米机械键盘",pic:"img/jiadian/diannao07.png",desc:"铝合金机身，TTC红轴，87键",price:"289元"},
        {name:"多功能转接器",pic:"img/jiadian/diannao08.jpg",price:"379元"},
        {desc:"电脑"}
    ],[
        {name:"米家恒温电水壶",pic:"img/jiadian/jiaju01.jpg",desc:"水温智能控制，304不锈钢内胆",price:"199元"},
        {name:"小米随身手电筒",pic:"img/jiadian/jiaju02.jpg",desc:"11档调光，随心而亮",price:"79元"},
        {name:"米家扫地机器人",pic:"img/jiadian/jiaju03.jpg",desc:"智能路径规划，扫得干净扫得快",price:"1699元"},
        {name:"小米空气净化器2",pic:"img/jiadian/jiaju04.jpg",desc:"10分钟，房间空气焕然一新",price:"699元"},
        {name:"米家压力IH电饭煲",pic:"img/jiadian/jiaju05.jpg",desc:"智能烹饪，灰铸铁粉体涂层内胆",price:"999元"},
        {name:"飞利浦智睿球泡灯",pic:"img/jiadian/jiaju06.jpg",desc:"自由调节亮度，Wi-Fi随时操控",price:"49元"},
        {name:"米家LED智能台灯",pic:"img/jiadian/jiaju07.jpg",desc:"无可视频闪，四种场景优化调光",price:"169元"},
        {name:"Yeelight LED 吸顶灯",pic:"img/jiadian/jiaju08.png",price:"379元"},
        {desc:"家居"}
    ],[
        {name:"米家恒温电水壶",pic:"img/jiadian/jiaju01.jpg",desc:"水温智能控制，304不锈钢内胆",price:"199元"},
        {name:"小米随身手电筒",pic:"img/jiadian/jiaju02.jpg",desc:"11档调光，随心而亮",price:"79元"},
        {name:"米家扫地机器人",pic:"img/jiadian/jiaju03.jpg",desc:"智能路径规划，扫得干净扫得快",price:"1699元"},
        {name:"小米空气净化器2",pic:"img/jiadian/jiaju04.jpg",desc:"10分钟，房间空气焕然一新",price:"699元"},
        {name:"米家压力IH电饭煲",pic:"img/jiadian/jiaju05.jpg",desc:"智能烹饪，灰铸铁粉体涂层内胆",price:"999元"},
        {name:"飞利浦智睿球泡灯",pic:"img/jiadian/jiaju06.jpg",desc:"自由调节亮度，Wi-Fi随时操控",price:"49元"},
        {name:"米家LED智能台灯",pic:"img/jiadian/jiaju07.jpg",desc:"无可视频闪，四种场景优化调光",price:"169元"},
        {name:"Yeelight LED 吸顶灯",pic:"img/jiadian/jiaju08.png",price:"379元"},
        {desc:"家居"}
    ]]
    for(var i = 0; i < around.length; i ++){
        $("<ul></ul>").addClass("brick-list clear-fix:after").appendTo($("#around .modle-bottom-right"));
        for(var j = 0; j < around[i].length - 2; j ++){
            $("<li></li>").addClass("brick-item brick-item-m").appendTo($("#around ul.brick-list").eq(i));
            $("<img src="+ around[i][j].pic +">").appendTo($("#around ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + around[i][j].name + "</p>").appendTo($("#around ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + around[i][j].desc + "</p>").addClass("desc").appendTo($("#around ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
            $("<p>" + around[i][j].price + "</p>").addClass("price").appendTo($("#around ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(j));
        }
        $("<li></li>").addClass("brick-item brick-item-s").appendTo($("#around ul.brick-list").eq(i));
        $("<img src="+ around[i][7].pic +">").appendTo($("#around ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<p>" + around[i][7].name + "</p>").appendTo($("#around ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<p>" + around[i][7].price + "</p>").addClass("price").appendTo($("#around ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(7));
        $("<li></li>").addClass("brick-item brick-item-s").appendTo($("#around ul.brick-list").eq(i));
        $("<small>" + around[i][8].desc + "</small>").appendTo($("<a>浏览更多</a>").appendTo($("#around ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(8)));    
        $("<i></i>").addClass("fa fa-angle-right").appendTo($("#around ul.brick-list:nth-of-type(" + (i + 1) + ") li").eq(8));
    }
    var currentAround = 0;
    $("#around ul.brick-list").eq(currentAround).show();
    $("#around ul.tab-list>li").eq(currentAround).addClass("tab-active");
    for(var i = 0; i < $("#around .tab-list>li").length; i ++){
        $("#around .tab-list>li")[i].index = i;
        $("#around .tab-list>li").eq(i).on("mouseenter", function(){
            $("#around ul.tab-list>li").eq(currentAround).removeClass("tab-active");
            $("#around ul.brick-list").eq(currentAround).hide();
            currentAround = this.index;
            $("#around .brick-list").eq(this.index).show();
            $("#around ul.tab-list>li").eq(currentAround).addClass("tab-active");
        });
    };
}